/* Livestream.module.css */

/* 顶部信息栏样式 */
.appContainer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.5));
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(5px);
}

.element1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.element1 img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  object-fit: cover;
}

.element1 span {
  font-size: 20px;
  font-weight: bold;
}

.element1 p {
  font-size: 12px;
  margin: 0;
  opacity: 0.8;
}

.element2 {
  flex: 1;
}

.element3 {
  display: flex;
  align-items: center;
  gap: 5px;
}

.element3 img {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  object-fit: cover;
}

.closeButton {
  margin-left: 15px;
  font-size: 24px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.closeButton:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* 直播主容器样式 */
.broadcasterContainer {
  position: relative;
  height: 100vh;
  width: 100%;
  background-color: #000;
  overflow: hidden;
  padding-top: 60px; /* 为顶部信息栏留出空间 */
  display: flex;
  flex-direction: column;
}

.webcamContainer {
  position: relative;
  height: calc(100% - 60px);
  width: 100%;
  overflow: hidden;
}

.webcamContainer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 弹幕容器样式 */
.danmakuContainer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 100px; /* 为底部控制面板留出空间 */
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}

.danmaku {
  position: absolute;
  right: -300px; /* 初始位置在屏幕右侧外 */
  white-space: nowrap;
  color: white;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  padding: 5px 10px;
  border-radius: 20px;
  background-color: rgba(0, 0, 0, 0.3);
  animation: danmakuMove 8s linear forwards;
  pointer-events: none;
  z-index: 8; /* 确保弹幕在大多数元素之上 */
}

@keyframes danmakuMove {
  from {
    right: -300px;
  }
  to {
    right: 100%;
  }
}

/* 礼物动画样式 */
.giftAnimation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: giftAppear 3s ease-in-out;
  z-index: 10;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.giftAnimation span {
  font-size: 100px;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
  display: block;
  margin: 10px 0;
}

.giftHeader {
  font-size: 18px;
  color: #FFD700;
  margin-bottom: 10px;
  font-weight: bold;
}

.giftName {
  font-size: 16px;
  color: white;
  margin-top: 10px;
}

@keyframes giftAppear {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* 覆盖文本样式 */
.overlayText {
  position: absolute;
  bottom: 80px;
  left: 20px;
  color: white;
  font-size: 16px;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 8px 20px;
  border-radius: 20px;
  animation: fadeIn 0.5s ease-in-out;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.overlayText1 {
  position: absolute;
  bottom: 130px;
  left: 20px;
  color: #ffcc00;
  font-size: 14px;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 5px 12px;
  border-radius: 15px;
  animation: slideIn 0.5s ease-in-out;
}

.overlayText2 {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 9;
}

.overlayText2 span {
  color: white;
  font-size: 14px;
  background-color: rgba(255, 0, 80, 0.7);
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.overlayText2 span:hover {
  background-color: rgba(255, 0, 80, 1);
  transform: scale(1.05);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 主播标题样式 */
.broadcasterTitle {
  text-align: center;
  color: white;
  background-color: #ff0050;
  padding: 8px 15px;
  margin: 10px auto;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  width: fit-content;
}

/* 控制面板样式 */
.controlPanel {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 15px 20px;
  border-radius: 30px;
  z-index: 10;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: fit-content;
  max-width: 80%;
}

.controlButton {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.controlButton:hover {
  transform: scale(1.1);
  background-color: rgba(255, 255, 255, 0.3);
}

.controlButton.disabled {
  background-color: rgba(255, 0, 0, 0.3);
}

.startButton {
  background-color: #4CAF50;
  width: auto;
  padding: 0 20px;
  font-weight: bold;
  border-radius: 25px;
  min-width: 100px;
}

.stopButton {
  background-color: #f44336;
  width: auto;
  padding: 0 20px;
  border-radius: 25px;
  min-width: 100px;
}

.videoDisabled {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #222;
  color: white;
}

/* 直播状态指示器 */
.liveIndicator {
  position: absolute;
  top: 20px;
  left: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.liveIndicator.active {
  background-color: rgba(220, 20, 60, 0.7);
  animation: pulse 2s infinite;
}

.liveIcon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ccc;
  display: inline-block;
}

.liveIndicator.active .liveIcon {
  background-color: #ff0000;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 20, 60, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(220, 20, 60, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 20, 60, 0);
  }
}

/* 观众数量指示器 */
.viewerIndicator {
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 直播质量指示器 */
.qualityIndicator {
  position: absolute;
  top: 70px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.qualityIndicator:hover {
  background-color: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

/* 设备类型指示器 */
.deviceIndicator {
  position: absolute;
  top: 120px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 网络状态指示器 */
.networkIndicator {
  position: absolute;
  top: 170px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.networkIndicator.excellent {
  background-color: rgba(76, 175, 80, 0.7);
}

.networkIndicator.good {
  background-color: rgba(255, 193, 7, 0.7);
}

.networkIndicator.poor {
  background-color: rgba(244, 67, 54, 0.7);
}

/* 设备选择器 */
.deviceButton {
  position: absolute;
  top: 220px;
  right: 20px;
  background-color: rgba(33, 150, 243, 0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  width: auto;
  min-width: 100px;
}

.deviceSelector {
  position: absolute;
  top: 270px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px;
  border-radius: 10px;
  z-index: 20;
  width: 250px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.deviceGroup {
  margin-bottom: 15px;
}

.deviceGroup h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #ccc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 5px;
}

/* 分享按钮样式 */
.shareButton {
  position: absolute;
  top: 20px;
  right: 120px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
}

.shareButton:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* 分享弹窗样式 */
.sharePopup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 400px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  overflow: hidden;
}

.sharePopupHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: #f8f8f8;
  border-bottom: 1px solid #eee;
}

.sharePopupHeader h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.closePopup {
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.sharePopupContent {
  padding: 20px;
}

.linkContainer {
  display: flex;
  align-items: center;
  margin: 15px 0;
  background-color: #f5f5f5;
  border-radius: 5px;
  padding: 5px 10px;
  border: 1px solid #ddd;
}

.shareLink {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  font-size: 14px;
  color: #333;
  outline: none;
}

.copyButton {
  background-color: #2196F3;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.copyButton:hover {
  background-color: #0d8bf2;
}

.qrContainer {
  text-align: center;
  margin: 15px 0;
}

.qrPlaceholder {
  width: 170px;
  height: 170px;
  background-color: #ffffff;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 10px;
}

.shareNote {
  font-size: 12px;
  color: #666;
  margin-top: 15px;
  text-align: center;
  font-style: italic;
}

.deviceOption {
  padding: 8px 10px;
  margin-bottom: 5px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: rgba(255, 255, 255, 0.1);
}

.deviceOption:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.deviceOption.selected {
  background-color: rgba(33, 150, 243, 0.5);
  border-left: 3px solid #2196F3;
}

@media (max-width: 768px) {
  .videoDisabled p {
    margin-top: 15px;
    font-size: 18px;
  }
  
  .controlPanel {
    padding: 10px 15px;
    gap: 10px;
    bottom: 15px;
  }
  
  .controlButton {
    width: 40px;
    height: 40px;
    font-size: 16px;
  } 
  
  .startButton, .stopButton {
    min-width: 80px;
    padding: 0 15px;
  }
  
  .overlayText2 {
    bottom: 80px;
    right: 15px;
  }
  
  .overlayText2 span {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .danmakuContainer {
    bottom: 120px;
  }
}

/* 更小屏幕设备的适配 */
@media (max-width: 480px) {
  .controlPanel {
    padding: 8px 10px;
    gap: 8px;
    bottom: 10px;
    max-width: 95%;
  }
  
  .controlButton {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }
  
  .startButton, .stopButton {
    min-width: 70px;
    padding: 0 10px;
    font-size: 12px;
  }
  
  .overlayText2 {
    bottom: 60px;
    right: 10px;
    gap: 5px;
  }
  
  .overlayText2 span {
    padding: 5px 10px;
    font-size: 11px;
  }
  
  .danmakuContainer {
    bottom: 100px;
  }
  
  .danmaku {
    font-size: 16px;
    padding: 4px 8px;
  }
}

/* 确保在横屏模式下也能正常显示 */
@media (orientation: landscape) and (max-height: 500px) {
  .controlPanel {
    bottom: 5px;
  }
  
  .overlayText2 {
    bottom: 60px;
  }
  
  .danmakuContainer {
    bottom: 80px;
  }
}